package com.framework;

import java.io.File;

import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JPanel;

public class DirectoryChooser extends JPanel  {
		   JButton go;
		   
		   JFileChooser chooser;
		   private File masterDirectory;
		   
		   
		  public DirectoryChooser() {
			  chooser = new JFileChooser(); 
			    chooser.setCurrentDirectory(new java.io.File("/"));
			    chooser.setDialogTitle("Fenetre de selection du dossier");
			    chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
			    chooser.setAcceptAllFileFilterUsed(false);
			     
			    if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
			    masterDirectory = 	chooser.getSelectedFile();
			      System.out.println("getCurrentDirectory(): " 
			         +  chooser.getCurrentDirectory());
			      System.out.println("getSelectedFile() : " 
			         +  chooser.getSelectedFile());
			      }
			    else {
			      System.out.println("No Selection ");
			      }
		   }
		  
		  public File getSelectedDirectory(){return masterDirectory;}
		 
}
